﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HeritageAcademy.Library.Controls
{
	/// <summary>
	/// Interaction logic for TestBoardListItem.xaml
	/// </summary>
	public partial class TestBoardListItem : UserControl
	{
        private Status testStatus;

		public TestBoardListItem()
		{
			this.InitializeComponent();
            UpdateDetails();
		}

        public enum Status
        {
            Succeded,
            Failed,
            None
        };

        public Status TestStatus
        {
            get { return testStatus; }
            set 
            { 
                testStatus = value;
                UpdateDetails();
            }
        }

        public string Title
        {
            get { return tbTitle.Text; }
            set { tbTitle.Text = value; }
        }

        private void UpdateDetails()
        {
            switch (testStatus)
            {
                case Status.Succeded:
                    bdrColor.Background = new SolidColorBrush(Color.FromArgb(255, 0, 160, 0));
                    break;
                case Status.Failed:
                    bdrColor.Background = new SolidColorBrush(Colors.Red);
                    break;
                case Status.None:
                    bdrColor.Background = new SolidColorBrush(Color.FromArgb(255, 188, 188, 188));
                    break;
                default:
                    bdrColor.Background = new SolidColorBrush(Color.FromArgb(255, 188, 188, 188));
                    break;
            }
        }
	}
}